﻿using System;
using System.ComponentModel;
using System.Windows;

namespace HalconDotNet
{
	// Token: 0x02000015 RID: 21
	public class HIconicDisplayObjectWPF : HDisplayObjectWPF
	{
		// Token: 0x060000E6 RID: 230 RVA: 0x00005A84 File Offset: 0x00003C84
		public HIconicDisplayObjectWPF(HObject obj)
		{
			this.IconicObject = obj;
		}

		// Token: 0x060000E7 RID: 231 RVA: 0x00005A93 File Offset: 0x00003C93
		public HIconicDisplayObjectWPF()
		{
		}

		/// <summary>
		/// Can contain a HImage, HRegion or HContXLD object to display.
		/// </summary>
		// Token: 0x17000029 RID: 41
		// (get) Token: 0x060000E8 RID: 232 RVA: 0x00005A9B File Offset: 0x00003C9B
		// (set) Token: 0x060000E9 RID: 233 RVA: 0x00005AAD File Offset: 0x00003CAD
		public HObject IconicObject
		{
			get
			{
				return (HObject)base.GetValue(HIconicDisplayObjectWPF.IconicObjectProperty);
			}
			set
			{
				base.SetValue(HIconicDisplayObjectWPF.IconicObjectProperty, value);
			}
		}

		// Token: 0x060000EA RID: 234 RVA: 0x00005ABC File Offset: 0x00003CBC
		private static void OnPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
		{
			HIconicDisplayObjectWPF hiconicDisplayObjectWPF = source as HIconicDisplayObjectWPF;
			if (hiconicDisplayObjectWPF == null)
			{
				return;
			}
			string name = e.Property.Name;
			if (!(name == "HColor"))
			{
				if (name == "HColored")
				{
					hiconicDisplayObjectWPF.HColor = null;
				}
			}
			else
			{
				hiconicDisplayObjectWPF.HColored = null;
			}
			HSmartWindowControlWPF parentHSmartWindowControlWPF = hiconicDisplayObjectWPF.ParentHSmartWindowControlWPF;
			if (parentHSmartWindowControlWPF != null)
			{
				parentHSmartWindowControlWPF.NotifyItemsChanged();
			}
		}

		/// <summary>
		/// Color of the HRegion or HContXLD object when it is displayed.
		/// Overwrites default color of the HWindow the object is displayed in.
		/// </summary>
		// Token: 0x1700002A RID: 42
		// (get) Token: 0x060000EB RID: 235 RVA: 0x00005B25 File Offset: 0x00003D25
		// (set) Token: 0x060000EC RID: 236 RVA: 0x00005B37 File Offset: 0x00003D37
		[Category("Appearance")]
		[EditorBrowsable(EditorBrowsableState.Always)]
		[Description("Color for displaying HRegion and HXLDCont objects. If HColor is set, HColored is set to null.")]
		public string HColor
		{
			get
			{
				return (string)base.GetValue(HIconicDisplayObjectWPF.HColorProperty);
			}
			set
			{
				base.SetValue(HIconicDisplayObjectWPF.HColorProperty, value);
			}
		}

		/// <summary>
		/// HColored property. Defines the colors that are used when the HRegion or
		/// HContXLD object is an iconic tuple.
		/// Overwrites default colored property of the HWindow the object is displayed in.
		/// </summary>
		// Token: 0x1700002B RID: 43
		// (get) Token: 0x060000ED RID: 237 RVA: 0x00005B45 File Offset: 0x00003D45
		// (set) Token: 0x060000EE RID: 238 RVA: 0x00005B57 File Offset: 0x00003D57
		[Category("Appearance")]
		[EditorBrowsable(EditorBrowsableState.Always)]
		[Description("Set of colors for displaying HRegion and HXLDCont objects. If HColored is set, HColor is set to null.")]
		public int? HColored
		{
			get
			{
				return (int?)base.GetValue(HIconicDisplayObjectWPF.HColoredProperty);
			}
			set
			{
				base.SetValue(HIconicDisplayObjectWPF.HColoredProperty, value);
			}
		}

		/// <summary>
		/// Line style used for drawing the margin of the HRegion or the HContXLD object.
		/// Overwrites default line style of the HWindow the object is displayed in.
		/// </summary>
		// Token: 0x1700002C RID: 44
		// (get) Token: 0x060000EF RID: 239 RVA: 0x00005B6A File Offset: 0x00003D6A
		// (set) Token: 0x060000F0 RID: 240 RVA: 0x00005B7C File Offset: 0x00003D7C
		[Category("Appearance")]
		[EditorBrowsable(EditorBrowsableState.Always)]
		[Description("Output pattern of the margin of HRegion objects and of HXLDCont objects.")]
		public HLineStyleWPF LineStyle
		{
			get
			{
				return (HLineStyleWPF)base.GetValue(HIconicDisplayObjectWPF.HLineStyleProperty);
			}
			set
			{
				base.SetValue(HIconicDisplayObjectWPF.HLineStyleProperty, value);
			}
		}

		/// <summary>
		/// Line width used for drawing the  margin of the HRegion or the HContXLD object.
		/// Overwrites default line width of the HWindow the object is displayed in.
		/// </summary>
		// Token: 0x1700002D RID: 45
		// (get) Token: 0x060000F1 RID: 241 RVA: 0x00005B8A File Offset: 0x00003D8A
		// (set) Token: 0x060000F2 RID: 242 RVA: 0x00005B9C File Offset: 0x00003D9C
		[Category("Appearance")]
		[EditorBrowsable(EditorBrowsableState.Always)]
		[Description("Line width of the margin of HRegion objects and of HXLDCont objects.")]
		public double? LineWidth
		{
			get
			{
				return (double?)base.GetValue(HIconicDisplayObjectWPF.HLineWidthProperty);
			}
			set
			{
				base.SetValue(HIconicDisplayObjectWPF.HLineWidthProperty, value);
			}
		}

		/// <summary>
		/// Drawing mode of HRegion objects. Can either be 'margin' or 'fill'.
		/// Overwrites default drawing mode of the HWindow the object is displayed in.
		/// </summary>
		// Token: 0x1700002E RID: 46
		// (get) Token: 0x060000F3 RID: 243 RVA: 0x00005BAF File Offset: 0x00003DAF
		// (set) Token: 0x060000F4 RID: 244 RVA: 0x00005BC1 File Offset: 0x00003DC1
		[Category("Appearance")]
		[EditorBrowsable(EditorBrowsableState.Always)]
		[Description("Fill mode of HRegion objects.")]
		public string HDraw
		{
			get
			{
				return (string)base.GetValue(HIconicDisplayObjectWPF.HDrawProperty);
			}
			set
			{
				base.SetValue(HIconicDisplayObjectWPF.HDrawProperty, value);
			}
		}

		/// <summary>
		/// Draw this object with the specified style into a HWindow.
		/// </summary>
		/// <param name="hWindow"></param>
		// Token: 0x060000F5 RID: 245 RVA: 0x00005BD0 File Offset: 0x00003DD0
		public override void Display(HWindow hWindow)
		{
			if (this.IconicObject != null && this.IconicObject.IsInitialized())
			{
				if (this.HColor != null)
				{
					hWindow.SetColor(this.HColor);
				}
				if (this.HColored != null)
				{
					hWindow.SetColored(this.HColored ?? 0);
				}
				if (this.HDraw != null)
				{
					this._tempDraw = hWindow.GetDraw();
					hWindow.SetDraw(this.HDraw);
				}
				if (this.LineStyle != null)
				{
					this._tempLineStyle = hWindow.GetLineStyle();
					hWindow.SetLineStyle(this.LineStyle);
				}
				if (this.LineWidth != null)
				{
					this._tempLineWidth = hWindow.GetLineWidth();
					hWindow.SetLineWidth(this.LineWidth ?? 1.0);
				}
				this.IconicObject.DispObj(hWindow);
				if (this.LineStyle != null)
				{
					hWindow.SetLineStyle(this._tempLineStyle);
					this._tempLineStyle.Dispose();
				}
				if (this.LineWidth != null)
				{
					hWindow.SetLineWidth(this._tempLineWidth);
					this._tempLineWidth.Dispose();
				}
				if (this.HDraw != null)
				{
					hWindow.SetDraw(this._tempDraw);
					this._tempDraw.Dispose();
				}
			}
		}

		// Token: 0x060000F6 RID: 246 RVA: 0x00005D4A File Offset: 0x00003F4A
		protected override void Dispose(bool disposing)
		{
			if (!this.disposed)
			{
				if (disposing && this.IconicObject != null)
				{
					this.IconicObject.Dispose();
				}
				this.disposed = true;
			}
		}

		// Token: 0x0400006F RID: 111
		public static readonly DependencyProperty IconicObjectProperty = DependencyProperty.Register("IconicObject", typeof(HObject), typeof(HIconicDisplayObjectWPF), new PropertyMetadata(null, new PropertyChangedCallback(HIconicDisplayObjectWPF.OnPropertyChanged)));

		// Token: 0x04000070 RID: 112
		public static readonly DependencyProperty HColorProperty = DependencyProperty.Register("HColor", typeof(string), typeof(HIconicDisplayObjectWPF), new PropertyMetadata(null, new PropertyChangedCallback(HIconicDisplayObjectWPF.OnPropertyChanged)));

		// Token: 0x04000071 RID: 113
		public static readonly DependencyProperty HColoredProperty = DependencyProperty.Register("HColored", typeof(int?), typeof(HIconicDisplayObjectWPF), new PropertyMetadata(null, new PropertyChangedCallback(HIconicDisplayObjectWPF.OnPropertyChanged)));

		// Token: 0x04000072 RID: 114
		public static readonly DependencyProperty HLineStyleProperty = DependencyProperty.Register("LineStyle", typeof(HLineStyleWPF), typeof(HIconicDisplayObjectWPF), new PropertyMetadata(null, new PropertyChangedCallback(HIconicDisplayObjectWPF.OnPropertyChanged)));

		// Token: 0x04000073 RID: 115
		public static readonly DependencyProperty HLineWidthProperty = DependencyProperty.Register("LineWidth", typeof(double?), typeof(HIconicDisplayObjectWPF), new PropertyMetadata(null, new PropertyChangedCallback(HIconicDisplayObjectWPF.OnPropertyChanged)));

		// Token: 0x04000074 RID: 116
		public static readonly DependencyProperty HDrawProperty = DependencyProperty.Register("HDraw", typeof(string), typeof(HIconicDisplayObjectWPF), new PropertyMetadata(null, new PropertyChangedCallback(HIconicDisplayObjectWPF.OnPropertyChanged)));

		// Token: 0x04000075 RID: 117
		private HTuple _tempLineStyle;

		// Token: 0x04000076 RID: 118
		private HTuple _tempLineWidth;

		// Token: 0x04000077 RID: 119
		private HTuple _tempDraw;
	}
}
